package com.bsi.sentinel.rest.controller;

import com.alibaba.cloud.sentinel.rest.SentinelClientHttpResponse;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName NormolController
 * @Author LiuSong
 * @Date 2020/7/30 16:22
 * @Version 1.0
 * @Description 普通使用sentinel的方法
 */
@RequestMapping("/normol")
@RestController
public class NormolController {

    @GetMapping("/demo_sentinel")
    @SentinelResource(value = "demo_sentinel", blockHandler = "block", fallback = "fallbackInfo")
    public String demoSentinel() {
        return "normalSentinel";
    }

    public String blockInfo() {
        return "block";
    }

    public String fallbackInfo() {
        return "fallback";
    }
}
